﻿using System;
using System.Data.Common;
using ApplicationLibrary.DBManager;
using ApplicationLibrary.SqlConnector;

namespace Plumber.Database
{
    #region Sales
    #region PL_SalesInvoices
    public class PL_SalesInvoices : Table
    {
        public static string Name = "PL_SalesInvoices";
        public static Column<string> InvoiceNo = new Column<string>(Name, Properties.Resources.T_SalesNo, "SalesNo", 21, false);
        public static Column<DateTime> ReleaseDate = new Column<DateTime>(Name, Properties.Resources.T_ReleaseDate, "ReleaseDate");
        public static Column<string> Type = new Column<string>(Name, Properties.Resources.T_Type, "Type", LEN.SHORT_CODE);
        public static Column<string> Master = new Column<string>(Name, Properties.Resources.T_Master, "Master", 21);
        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", 16);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", 64);
        public static Column<string> Address = new Column<string>(Name, Properties.Resources.T_Address, "Address", 128);
        public static Column<string> ZipCode = new Column<string>(Name, Properties.Resources.T_ZipCode, "ZipCode", 5);
        public static Column<string> City = new Column<string>(Name, Properties.Resources.T_City, "City", 35);
        public static Column<string> County = new Column<string>(Name, Properties.Resources.T_County, "County", 2);
        public static Column<string> TaxNo = new Column<string>(Name, Properties.Resources.T_TaxNo, "TaxNo", 11);
        public static Column<string> FiscalCode = new Column<string>(Name, Properties.Resources.T_FiscalCode, "FiscalCode", 16);
        public static Column<string> Administrator = new Column<string>(Name, Properties.Resources.T_Administrator, "Administrator", 21);
        public static Column <string>InvoiceBody = new Column<string>(Name, "", "InvoiceBody", 4000);

        public static Column<DateTime> PaymentDate = new Column<DateTime>(Name, Properties.Resources.T_PaymentDate, "PaymentDate");
        public static Column<bool> SalePayed = new Column<bool>(Name, Properties.Resources.T_SalePayed, "SalePayed");
        public static Column<bool> PrintEnvelope = new Column<bool>(Name, Properties.Resources.T_PrintEnvelope, "PrintEnvelope");

        public static Column<float> Amount = new Column<float>(Name, "", "Amount");
        public static Column<float> Total = new Column<float>(Name, "", "Total");
        public static Column<float> Tax = new Column<float>(Name, "", "Tax");
        public static Column<int> TaxCode = new Column<int>(Name, "", "TaxCode");

        public static Column<bool> Restraint = new Column<bool>(Name, Properties.Resources.T_SalePayed, "Restraint");
        public static Column<int> RestraintCode = new Column<int>(Name, "", "RestraintCode");
        public static Column<float> RestraintAmount = new Column<float>(Name, "", "RestraintAmount");

        public static Column<string> MasterDesc = new Column<string>(Name, "", "MasterDesc", 35);
        public static Column<string> AdminDesc = new Column<string>(Name, "", "AdminDesc", 35);
        public static Column<string> TitleDesc = new Column<string>(Name, "", "TitleDesc", 35);

        public PL_SalesInvoices()
        {
            VisibleInRadar(new iColumn[] { InvoiceNo, Master, Description, Address, Administrator });
            Tablename = Name;
            DefineKey(new iColumn[] { InvoiceNo });
        }
    }

    #endregion
    #region PL_Sentences
    public class PL_Sentences : Table
    {
        public static string Name = "PL_Sentences";

        public static Column<int> ID = new Column<int>(Name, "", "ID", false, true);
        public static Column<string> Title = new Column<string>(Name, Properties.Resources.T_Title, "Title", 21);
        public static Column<string> Text = new Column<string>(Name, "", "Text", 1024);

        public PL_Sentences()
        {
            VisibleInRadar(new iColumn[] { ID, Title });
            Tablename = Name;
            DefineKey(new iColumn[] { ID });
        }
    }
    #endregion
    #region PL_Templates
    public class PL_Templates : Table
    {
        public static string Name = "PL_Templates";

        public static Column<string> Code = new Column<string>(Name, Properties.Resources.T_Code, "Code", LEN.LONG_CODE, false);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.DESCRIPTION);
        public static Column<string> Body = new Column<string>(Name, "", "Body", 2048);
        public static Column<string> Combine = new Column<string>(Name, "", "Combine", 2048);

        public PL_Templates()
        {
            VisibleInRadar(new iColumn[] { Code });
            Tablename = Name;
            DefineKey(new iColumn[] { Code });
        }
    }
    #endregion
    #endregion
    #region Accounting
    #region PL_JournalEntry
    public class PL_JournalEntry : Table
    {
        public static string Name = "PL_JournalEntry";

        public static Column<string> JournalNo = new Column<string>(Name, "", "JournalNo", LEN.CODE,  false);
        public static Column<string> Template = new Column<string>(Name, Properties.Resources.T_Template, "Template", LEN.SHORT_CODE);
        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.BIG_DESCRIPTION);
        public static Column<DateTime> PostingDate = new Column<DateTime>(Name, Properties.Resources.T_PostingDate, "PostingDate");

        public PL_JournalEntry()
        {
            VisibleInRadar(new iColumn[] {JournalNo, Description });
            Tablename = Name;
            DefineKey(new iColumn[] { JournalNo });
        }
    }
    #endregion
    #region PL_JournalEntryDetail
    public class PL_JournalEntryDetail : Table
    {
        public static string Name = "PL_JournalEntryDetail";

        public static Column<string> JournalNo = new Column<string>(Name, "", "JournalNo", LEN.CODE,  false);
        public static Column<int> Line = new Column<int>(Name, "", "Line", false);
        public static Column<MasterTypes> FromAccountType = new Column<MasterTypes>(Name, "", "FromAccountType");
        public static Column<string> FromMasterCode = new Column<string>(Name, "", "FromMasterCode", LEN.CODE);
        public static Column<float> FromAmount = new Column<float>(Name, "", "FromAmount");

        public static Column<MasterTypes> ToAccountType = new Column<MasterTypes>(Name, "", "ToAccountType");
        public static Column<string> ToMasterCode = new Column<string>(Name, "", "ToMasterCode", LEN.CODE);
        public static Column<float> ToAmount = new Column<float>(Name, "", "ToAmount");

        public static Column<string> Description = new Column<string>(Name, Properties.Resources.T_Description, "Description", LEN.DESCRIPTION);

        public PL_JournalEntryDetail()
        {
            Tablename = Name;
            DefineKey(new iColumn[] { JournalNo, Line });
        }
    }
    #endregion
    #endregion
   }
